
# 导入配置到 etcd
config:
	etcdctl put "/ebike/config/manager"  < ./script/config.json

group = ebike_registry
project = manager
version= latest
hub_user=深圳市豆点云科技术有限公司
hub_pwd=dev%ddyk@219_i
server=registry.cn-hangzhou.aliyuncs.com
default:
	@echo ${group}/${project}

build: #执行 make -f makefile build
	CGO_ENABLED=0 GOOS=linux GOARCH=amd64  go build -buildvcs=false -o ./bin/${project}

image:build
	docker build -t ${group}/${project}:${version} --platform linux/amd64 --build-arg ARG_PROJECT_NAME=${project} .

push:image
	docker login -u ${hub_user} -p ${hub_pwd} ${server}
	docker tag ${group}/${project}:${version} ${server}/${group}/${project}:${version}
	docker push ${server}/${group}/${project}:${version}

container:
	docker rm -f ${group}_${project}
	docker run --name ${group}_${project} -d --net host --restart always -e MICRO_REGISTRY=etcd -e MICRO_REGISTRY_ADDRESS=etcd:2379 ${group}/${project}

.PHONY: defaul build image push container
